package cn.itcast.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @Author: 欧阳辉
 * @Description:生成随机订单号
 * @Date: Created in 8:26 2020/3/17
 * @Modified By:
 */
public class OrderNumber {


    /**
     *
     * @Description:
     * 随机生成订单号
     * @auther: 欧阳辉
     * @date: 8:23 2020/3/17
     * @param: []
     * @return: java.lang.String
     *
     */
    public static String getOrderIdByTime() {
        SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss");
        String newDate=sdf.format(new Date());
        String result="";
        Random random=new Random();
        for(int i=0;i<3;i++){
            result+=random.nextInt(10);
        }
        return newDate+result;
    }


}
